<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/component/pear/css/pear.css"/>
    <link rel="stylesheet" href="/component/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox" style="    display: flex;
    flex-direction: column;
    align-content: space-around;
    flex-wrap: nowrap;
    justify-content: center;">
        <div class="main-container">
            <div class="main-container">
                <div class="layui-form-item" style="display: none;">
                    <div class="layui-input-block">
                        <input type="text" name="archivedId" required="" th:value="${id}" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span style="color: red">*</span>归档类型名
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="archivedName" name="archivedName" required=""
                               placeholder="请输入档案属性名" th:value="${archived_name}" lay-verify="required" lay-reqtext="请输入归档类型名" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="attribute-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="/component/layui/layui.js"></script>
<script src="/component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        form.on('submit(attribute-save)', function (data) {
            let loading = layer.load();
            $.ajax({
                url: '/archived/type/editInfo',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (result) {
                    layer.close(loading);
                    if (result.code == 200) {
                        layer.msg(result.message, {icon: 1, time: 3000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("testReload");
                        });
                    } else {
                        layer.msg(result.message, {icon: 2, time: 3000});
                    }
                }
            })
            return false;
        });
    })
</script>
<script>
</script>
</body>
</html>